<template>
  <slot></slot>
</template>

<script>
import { provide, watch } from 'vue'

export default {
  name: 'BxLocaleProvider',
  props: {
    locale: {
      type: Object,
      default: () => ({})
    }
  },
  setup(props) {
    provide('locale', props.locale)

    watch(() => props.locale, (newLocale) => {
      provide('locale', newLocale)
    }, { deep: true })
  }
}
</script>

